package analyticsServer;

import java.util.ArrayList;

/**
 * Class for Events concerning Auctions (Auction startet or ended)
 * 
 * @author Group 95
 */
public class AuctionEvent extends Event
{
    protected long auctionId;
    
    public static String AUCTION_STARTED="AUCTION_STARTED";
    public static String AUCTION_ENDED="AUCTION_ENDED";
    
    
    public AuctionEvent(String server,String type,long timestamp,long auctionId)
    {
        super(server,type,timestamp);
        this.auctionId=auctionId;
    }

    public long getAuctionId()
    {
        return this.auctionId;
    }
    
    @Override
    public String toString()
    {
        String strRet=super.toString()+"auction "+auctionId+" ";
        if(type.equals(AUCTION_STARTED))
        {
            strRet+="started";
        }
        else if(type.equals(AUCTION_ENDED))
        {
            strRet+="ended";
        }
        return strRet;
    }
    
    @Override
    public ArrayList<StatisticsEvent> calculate(EventCalculator calculator)
    {
        return calculator.calculate(this);
    }    
}
